﻿<%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage<dynamic>" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>年龄分析</title>
     <script src="../../Scripts/jquery-1.9.1.js" type="text/javascript"></script>
    <link href="../../Content/Themes/blue2/css.css" rel="stylesheet" type="text/css" />
    <style type="text/css">
        .allContent{ width:800px; margin:0px auto;}
          .show_tp{  margin-bottom:10px;}
         .labelMargin{ display:inline-block; margin-left:20px;}
         .inputNUM{ width:100px;}
    </style>
</head>
<body class="main">
     <div class="AllWebTopDiv">
        <div class="path">
            <div class="nav">
                <a href="#">年龄分析</a>
            </div>
        </div>
        <div class="content">
          <div class="allContent">
           <div class="show_tp" id="show_tp">
             <label class="labelMargin">性别：</label><select id="sex"><option value="0">全部</option><option value="1">男</option><option value="2">女</option></select>
             <label class="labelMargin">会员等级：</label><%:Html.DropDownList("memberLevel") %>
             <label class="labelMargin">消费金额：</label><select id="consume"><option value="0">></option><option value="1"><</option></select>：<input  type="text" id="inputNum" class="inputNUM"/>
             <input  type="button" value="搜索" onclick="searchData()" class="button2"  style="margin-left:50px;"/>
              <input  type="button" value="搜索全部" onclick="searchAllData()" class="button2"  style="margin-left:20px;"/>
              <input  type="button" id="exit" value="关闭" onclick="closeWindows();" class="button2" style="margin-left:20px;"/>
            </div>
            <div >
              <img id="chart" src="<%:Url.Action("Pie","AgeanalyseChart") %>" alt="未找到数据"/>
            </div> 
            </div>
        </div>
    </div>
</body>
</html>
<script  type="text/javascript">

    function searchData() {
        if (!String.prototype.trim) {
            var TRIM_REG = /(^\s*)|(\s*$)/g;
            String.prototype.trim = function () { return this.replace(TRIM_REG, ''); }
        }
       var inputNum = document.getElementById('inputNum').value.trim();
        if (inputNum.length != 0) {
            reg = /^[-+]?\d*$/;
            if (!reg.test(inputNum)) {
                alert("金额应为整数");
                return false;

            }
        } 
       var sex= $("#sex").val();
       var memberLevel=  $("#memberLevel").val();
       var consume = $("#consume").val();
       $("#chart").attr("src", "/AgeanalyseChart/Pie?sex=" + sex + "&memberLevel=" + memberLevel + "&consume=" + consume + "&inputNum=" + inputNum + "");
   }

   function searchAllData() { 
        
        $("#chart").attr("src", "/AgeanalyseChart/Pie");
    }
    //关闭窗口
    function closeWindows() {
        window.location.href = "/Loading/Index/?src=/Desktop/Index/";
    }
</script>